#ifndef DBPARACHUTE_H
#define DBPARACHUTE_H

#include "main_inc.h"
#include "clog.h"
#include "dbtime.h"

#define DAY 86400

class DBParachute
{
	protected:
		DBParachute();
		virtual ~DBParachute();
	public:
		static DBParachute *PARA();

		i32 WriteBlock ( time_t sys_time, time_t ext_time,u8 type, void *data, u32 size,string comment = "" );
		i32 WriteErrCode ( time_t sys_time, i32 errcode, string errstr );
		i32 WriteMsg ( time_t sys_time, i32 lvl, string msg );
	protected:
		i32 OpenParaFile ( time_t sys_time );
		i32 CloseParaFile();
		string timeToName(time_t sys_time);

    FILE *fhandle;
    time_t fopened;

	protected:
	private:
};

extern DBParachute *g_parachute;

#endif // DBPARACHUTE_H
